﻿/// <reference path="../../Scripts/jquery-1.4.1-vsdoc.js" />

var userId = 0;

function submitData() {
	var roles = "";
	$("#allRoles input[type=checkbox]").each(function (i, cb) {
		if (cb.checked) {
			if (i > 0) {
				roles += ",";
			}
			roles += $(cb).val();
		}
	});

	$.post(actionUrl("Authority", "AJAX_SubmitRoles"), {
		"userId": userId,
		"roles": roles
	}, function (res) {
		alert(res.Message);
		if (res.Success) returnBack();
	});
}

function returnBack() {
	window.location.href = actionUrl("Authority", "UserList");
}